package com.yoomiito.app.ui.yijiayou

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.yoomiito.app.R
import com.yoomiito.app.model.oilcard.OilCardOrderDetail
import com.yoomiito.app.utils.ResUtil

class OilCarDetailAdapter(data:List<OilCardOrderDetail>?) :BaseQuickAdapter<OilCardOrderDetail,BaseViewHolder>(R.layout.view_oil_card_detail_item,data){

    override fun convert(helper: BaseViewHolder?, item: OilCardOrderDetail) {
        helper?.setText(R.id.orderTv,item.accountTypeDes)
        helper?.setGone(R.id.orderStatus,false)
        var des = ""
        item.accountTypeDesDetail.forEachIndexed {index,it->
            if (index==0){
                des = it
            }else{
                des+="\n${it}"
            }
        }
        helper?.setText(R.id.orderDes,des)
        helper?.getView<TextView>(R.id.orderMoney).let {
            it?.text = item.money
            it?.setTextColor(ResUtil.getColor(if (item.money.contains("+")) R.color.color_order_bg else R.color.color_balk_333333))
        }
        helper?.setText(R.id.orderMoney2,"优惠")
        helper?.setGone(R.id.orderMoney2,item.biz_type==5)
        helper?.setText(R.id.orderDate,item.ctime)
    }

}